package com.daon.util;

import org.apache.commons.lang3.StringUtils;

/**
 * @Author 1daon
 * @EMAIL 532418116@qq.com
 * @Version 创建时间：2018/3/15 下午8:41
 * @Modified By 计算树形结构层级
 */
public class LevelUtil {

    public final static String SEPARATOR = ".";

    public final static String ROOT      = "0";

    //0
    //0.1
    //0.1.2
    //0.1.3
    //0.4
    public static String calculateLevel(String parentLevel, int parentId){
        if(StringUtils.isBlank(parentLevel)){
            return ROOT;
        }else{
            return StringUtils.join(parentLevel, SEPARATOR, parentId);
        }
    }
}
